# Contributor: Michał Polański <michal@polanski.me>
# Contributor: Daniel Isaksen <d@duniel.no>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=elvish
pkgver=0.19.2
pkgrel=4
pkgdesc="Friendly and expressive Unix shell"
url="https://elv.sh/"
arch="all"
license="BSD-2-Clause"
makedepends="go"
source="https://github.com/elves/elvish/archive/v$pkgver/elvish-$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
export GOFLAGS="$GOFLAGS -trimpath -mod=readonly -modcacherw"
export CGO_ENABLED=0

build() {
	go build -ldflags="
		-X src.elv.sh/pkg/buildinfo.Reproducible=true
		-X src.elv.sh/pkg/buildinfo.VersionSuffix=+alpine$pkgrel
	" ./cmd/elvish
}

check() {
	go test ./...
}

package() {
	install -Dm755 elvish -t "$pkgdir"/usr/bin
}

sha512sums="
e7851659465e01fead104e36a73d0af5d4610e33018c6659e0cdc167e941c926ab4fd8b361da1b24dc88f4c07f6fa77077e069bfeaf0bbadb09913a05f58a2ba  elvish-0.19.2.tar.gz
"
